using System;
using SmartPeople.Framework.SecuritySpace;

namespace SmartPeople.Framework.SecuritySpace
{
    public interface ISecurityUsersProvider
    {
        /// <summary>
        /// Authenticates the specified user name.
        /// </summary>
        /// <param name="userName">Name of the user.</param>
        /// <param name="password">The password.</param>
        /// <returns></returns>
        IToken Authenticate(string userName, string password);

        /// <summary>
        /// Creates the user.
        /// </summary>
        /// <param name="userName">Name of the user.</param>
        /// <param name="password">The password.</param>
        /// <param name="email">The email.</param>
        /// <returns></returns>
        ISecurityUser CreateUser(string userName, string password, string email);


        /// <summary>
        /// Creates the user.
        /// </summary>
        /// <param name="userName">Name of the user.</param>
        /// <param name="password">The password.</param>
        /// <param name="email">The email.</param>
        /// <param name="passwordQuestion">The password question.</param>
        /// <param name="passwordAnswer">The password answer.</param>
        /// <returns></returns>
        ISecurityUser CreateUser(string userName, string password, string email, string passwordQuestion,
                                 string passwordAnswer);

        /// <summary>
        /// Creates the user.
        /// </summary>
        /// <param name="userName">Name of the user.</param>
        /// <param name="password">The password.</param>
        /// <param name="email">The email.</param>
        /// <param name="passwordQuestion">The password question.</param>
        /// <param name="passwordAnswer">The password answer.</param>
        /// <param name="isApproved">if set to <c>true</c> [is approved].</param>
        /// <param name="comment">The comment.</param>
        /// <returns></returns>
        ISecurityUser CreateUser(string userName, string password, string email, string passwordQuestion,
                                 string passwordAnswer, bool isApproved, string comment);


        ISecurityUser CreateUser(string userName, string password, string email, string passwordQuestion,
                         string passwordAnswer, bool isApproved, string comment,string description,bool isLockedOut);


        //TODO: See if IP Address thing is there or remove.
        /// <summary>
        /// Authenticates the specified user name.
        /// </summary>
        /// <param name="userName">Name of the user.</param>
        /// <param name="password">The password.</param>
        /// <param name="IPAddress">The IP address.</param>
        /// <param name="creationDate">The creation date.</param>
        /// <param name="timeout">The timeout.</param>
        /// <param name="lastactive">The lastactive.</param>
        /// <returns></returns>
        IToken Authenticate(string userName, string password, string IPAddress, DateTime creationDate, int timeout,
                            DateTime lastactive);


        /// <summary>
        /// Creates the user.
        /// </summary>
        /// <param name="userGuid">The user GUID.</param>
        /// <returns></returns>
        ISecurityUser CreateUser(Guid userGuid);


        /// <summary>
        /// Gets the user.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <param name="online">if set to <c>true</c> [online].</param>
        /// <returns></returns>
        ISecurityUser GetUser(IToken token, bool online);

        /// <summary>
        /// Gets the user.
        /// </summary>
        /// <param name="userName">Name of the user.</param>
        /// <param name="userIsOnline">if set to <c>true</c> [user is online].</param>
        /// <returns></returns>
        ISecurityUser GetUser(string userName, bool userIsOnline);

        /// <summary>
        /// Gets the users.
        /// </summary>
        /// <param name="userNames">The user names.</param>
        /// <returns></returns>
        ISecurityUser[] GetUsers(string[] userNames);

        /// <summary>
        /// Gets all users.
        /// </summary>
        /// <returns></returns>
        ISecurityUser[] GetAllUsers();

        /// <summary>
        /// Gets the user name by email.
        /// </summary>
        /// <param name="email">The email.</param>
        /// <returns></returns>
        string GetUserNameByEmail(string email);

        /// <summary>
        /// Updates the user.
        /// </summary>
        /// <param name="user">The user.</param>
        void UpdateUser(ISecurityUser user);

        /// <summary>
        /// Users the exists.
        /// </summary>
        /// <param name="userName">Name of the user.</param>
        /// <returns></returns>
        bool UserExists(string userName);

        /// <summary>
        /// Deletes the user.
        /// </summary>
        /// <param name="userName">Name of the user.</param>
        /// <param name="deleteAllRelatedData">if set to <c>true</c> [delete all related data].</param>
        /// <returns></returns>
        bool DeleteUser(string userName, bool deleteAllRelatedData);

        /// <summary>
        /// Gets the count.
        /// </summary>
        /// <value>The count.</value>
        int Count { get; }

        /// <summary>
        /// Clears this instance.
        /// </summary>
        void Clear();

        //ISecurityUser GetUser(Guid GID, bool userIsOnline);
    }
}